<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>IE 缓存问题</title>
    </head>
    <body>
        <button>点击发送 AJAX 请求</button>

        <script>
            //获取按钮
            let btn = document.querySelector("button");

            //绑定事件
            btn.onclick = function () {
                //向服务发送 HTTP 请求
                //1. 实例化对象
                let xhr = new XMLHttpRequest();
                //2. 初始化 设置请求基本信息
                xhr.open("get", "http://127.0.0.1/server?t=" + Date.now()); //open 打开
                //3. 发送
                xhr.send();
                //4. 绑定事件 获取响应结果
                xhr.onreadystatechange = function () {
                    //判断
                    if (xhr.readyState === 4) {
                        //响应体
                        console.log(xhr.response);
                    }
                };
            };
        </script>
    </body>
</html>
